<template>
  <div style="width: 100%">
    <el-form ref="form" :rules="rules" :model="userForm" label-width="80px">
      <el-form-item label="昵称" prop="nickname">
        <el-input v-model="userForm.nickname"></el-input>
      </el-form-item>
      <el-form-item label="邮箱" prop="email">
        <el-input v-model="userForm.email"></el-input>
      </el-form-item>
      <el-form-item label="手机号" prop="mobile">
        <el-input v-model="userForm.mobile"></el-input>
      </el-form-item>
      <el-form-item label-width="0" style="text-align: center">
        <el-button type="primary" @click="onSubmit">保存修改</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>

export default {
  name: "edit-user",
  data() {
    return {
      rules: {
        question: [
          {required: true, message: '请输入问题描述', trigger: 'blur'}
        ],
        answer: [
          {required: true, message: '请输入问题解答', trigger: 'blur'}
        ]
      }
    }
  },
  methods: {
    onSubmit() {
      this.$refs['form'].validate((valid) => {
        if (valid) {

        } else {
          return false;
        }
      })
    }
  },
  computed: {
    userForm(){
      return JSON.parse(JSON.stringify(this.$store.state.userInfo))
    }
  }
}
</script>

<style scoped>

</style>
